package com.tencent.FanXing;

public class Demo2 {

	public static void main(String[] args) {
		MyClass class1 = new MyClass("小飞");
		System.out.println((String)class1.getData());
		MyClass class2 = new MyClass(10);
		System.out.println((Integer)class2.getData());
	//解决方案：	把接收数据的类型改成根父类object
//解决了类的膨胀问题，缺点就是必须要做强制类型转换，容易出错
	}

}

class MyClass{
	private Object Data;

	public MyClass(Object data) {
		this.Data = data;
	}

	public Object getData() {
		return Data;
	}

	public void setData(Object data) {
		Data = data;
	}
}